<?php if($this->item ):?>
<?php $filter=new Zen_Huminizer(); ?>
<?php $item=$this->item; ?>
<?php 
$type = $item['parent']['label'];
$type=trim(mb_strtolower($type,"UTF-8"));
	switch ($type){
				case "диваны":{
					$compl="В комплекте с диваном";
					$name="Диван";
					break;  
				}
				case "угловые диваны":{
					$compl="В комплекте с угловым диваном";
					$name="Диван угловой";
					break;  
				}
				case "столы":{
					$compl="В комплекте со столом";
					$name="Стол";
					break;  
				}
				
				case "кресла":{
					$compl="В комплекте с креслом";
					$name="Кресло";
					break;  
				}
				case "кресла реклайнеры":{
					$compl="В комплекте с креслом";
					$name="Кресло-реклайнер";
					break;  
				}
				default:{
					$name="";
					$compl="";
					break; 
				}
			}
?>

<div id="wares_item" class="clearfix">
<h1 class="main_label"><?=$name ?>&nbsp;&laquo;<?=$item['label'] ?>&raquo;</h1>
<div class="images clearfix" style='width:665px;'>

<?php if($item['file3d']!=""):?>

<ul id="show_wares" class="clearfix">
	<li>
		<span>Показать:</span>
	</li>
	<li class="active">
		<a rel="photo" href="#">Фото</a>
	</li>
	
	<li>
		<a rel="3d" href="#">3D конфигуратор</a>
	</li>
</ul>

<?php endif;?>

	<?php $images=explode(',', trim($item['images']));?>
		<?php if($images[0]):?>
		<div id="item_imgs">
			<?php $size=sizeof($images);
					$cim=$images[0];
					$alt="Купить ".mb_strtolower($name,"UTF-8")." ".$item['label'];
					
			?>
		<a id='zoom1' rel='zoomWidth: 410, zoomHeight: "auto"' class="image_wrap cloud-zoom" href="<?=$this->image_Helper($cim)->getUrl()?>"><?=$this->image_Helper($cim)->crop()->resize(600,400)->merge(ROOT_PATH.Zen_Theme::_('/img/loop.png'), "right - 20", "bottom - 20")->render();?>
		<?php if($item['stripe']):?>
						<b class="stripe birka_cat_<?=$item['stripe']?>"></b>
						<?php endif;?>
		</a>
		<?php if($item['file3d']!=""):?>
		<div id="item_3d">
			<div style="margin:0 auto;width:546px;height:410px;">
			<object height="100%" width="100%" type="application/x-shockwave-flash" data="<?=$item['file3d'] ?>">
				<param name="movie" value="<?=$item['file3d'] ?>">
                <param value="opaque" name="wmode">
				<param name="quality" value="high">
			</object>
			</div>
		</div>
		<?php endif;?>
		
		<?if($size>4):?>
		<a class="prev browse left"></a>
		<? endif;?>
		<div class="scrollable"><div class="items">
				<?php $images=array_chunk($images, 4)?>
				<?php	$main_image_url = '';
					 foreach ($images as $page):?>
					<div>
					<?php foreach ($page as $id):
						if(!$main_image_url)
							$main_image_url = $this->image_Helper($id)->crop()->resize(600,400,'inside','any')->getUrl();
					?>
						<a class='cloud-zoom-gallery' href="<?=$this->image_Helper($id)->getUrl()?>" rel="useZoom: 'zoom1', smallImage: '<?=$this->image_Helper($id)->crop()->resize(600,400,'inside','any')->merge(ROOT_PATH.Zen_Theme::_('/img/loop.png'), "right - 20", "bottom - 20")->getUrl();?>' ">
							<?=$this->image_Helper($id)->crop()->resize(134,90,'fill', 'any')->render();?>
						</a>						
					<?php endforeach;?>
					</div>
				<?php endforeach;?>
			</div></div>
		<?if($size>4):?>
			<a class="next browse right"></a>
		<?php endif;?>
			<br class="clear"/>
		</div>
	<?php endif;?>
	
	<div class="socials" style="text-align: right;">
		<script type="text/javascript" src="//yandex.st/share/share.js" charset="utf-8"></script>
		<script type="text/javascript">
				VK.init({apiId: <?=$item['id'] ?>, onlyWidgets: true});	
				
		</script>
		<div style="float: left;padding-top: 4px;">
			<div id="vk_like"></div>
		</div>
		<div style="float: left;padding-top: 5px;width: 150px;">
			<iframe src="http://www.facebook.com/plugins/like.php?href=www.formula-divana.ru<?=$this->url()?>&amp;send=false&amp;layout=button_count&amp;width=450&amp;show_faces=true&amp;action=like&amp;colorscheme=light&amp;font=arial&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:21px;" allowTransparency="true"></iframe>
		</div>
		<script type="text/javascript">
			window.onload = function () {
 				VK.init({apiId: 2257184, onlyWidgets: true});
 				VK.Widgets.Like('vk_like', {type: "button", pageDescription:'<?=str_replace("\r\n"," ", strip_tags($item['info']));?>',pageTitle: '<?=$name." ".$item['label'] ?>',pageImage:'http://www.formula-divana.ru<?=$this->image_Helper($cim)->crop()->resize(142,94,'fill', 'any')->getUrl();?>'});
			}
		</script>

		<div style="float: left;padding-top: 5px;width: 150px;">
			<a href="https://twitter.com/share" class="twitter-share-button" data-lang="ru" style="float: left">Твитнуть</a>
			<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
		</div>

		<div style="float: left;padding-top: 5px;width: 100px;">
			<a href="http://pinterest.com/pin/create/button/?url=http%3A%2F%2Fwww.formula-divana.ru&media=http%3A%2F%2Fwww.formula-divana.ru%2F<?=urlencode($main_image_url)?>&description=<?=urlencode(substr(trim(strip_tags($item['info'])),0,1500))?>" class="pin-it-button" count-layout="horizontal"><img border="0" src="//assets.pinterest.com/images/PinExt.png" title="Pin It" /></a>
		</div>
		
		<div style="float: right;" class="yashare-auto-init" data-yashareL10n="ru" data-yashareType="none" data-yashareQuickServices="yaru,vkontakte,facebook,odnoklassniki,moimir,lj,friendfeed,moikrug"></div><div style="float: right;line-height: 28px;">Поделиться:</div> 

		<script type="text/javascript" src="//assets.pinterest.com/js/pinit.js"></script>
	</div>
	
	<?if(mb_strlen($item['info'],'UTF-8')>2):?>
	<div id="item_info">
		<?=$item['info']?>
		<br/><br/>
	</div>
	<?endif;?>
	<?if(isset($item['near']) && $item['near']):?>
		<div id="item_near">
		<?php if ($compl):?>
		<h3 class='hd'><?=$compl ?>&nbsp;&laquo;<?=$item['label']?>&raquo;&nbsp;мы&nbsp;рекомендуем</h3>
		<?php endif;?>
		<?php $size=count($item['near']);?>
		<?if($size>0):?>
			<?if($size>3):?>
			<a class="prev browse left"></a>
			<? endif;?>
			<div class="scrollable"><div class="items">
					<?php $images=array_chunk($item['near'], 3)?>
					<?php foreach ($images as $page):?>
						<div>
							<?php foreach ($page as $near):?>
								<?php $img=explode(',', trim($near['images']));?>
								<a  href="/shop/<?=$near['folder']['alias']."/".$near['alias'] ?>"<?if($img[0]):?> style="background-image:url(<?=$this->image_Helper($img[0])->crop()->resize(185,160)->getUrl();?>)" <?endif;?>><?= $near['label']?></a>
							<?php endforeach;?>
						</div>
								
					<?php endforeach;?>
				</div>
			</div>
			<?if($size>3):?>
			<a class="next browse right"></a>
			<? endif;?>
		<? endif;?>	
			<br class="clear"/>
		</div>
	<?endif;?>
	
</div>
<div class="info" style='width: 310px;'>
		
		<?php $store = $this->action('input','index','store');?>
		<?php $city_alias = $this->placeholder('city_alias')->getValue();?>
		
		<div class="price" style='margin: 0;'>
			<?php if ($item['price']):?>
			<span>Цена от</span>&nbsp;<?=$filter->price($item['price']);?>&nbsp;р.
			<br/><br/><br/>
			<?php endif;?>
			<a  style="background-color:white" class="button" href="/kupit/<?=$city_alias?>/"><span>Где купить?</span></a>
			<br/><br/><br/>
		</div>

		<?php $sizes=explode(',', trim($item['sizes']));?>
		<?php if($sizes[0]):?>
		<span class="sizes_label">Общие размеры в мм</span>
		<?php if(sizeof($sizes)==2):?>
			<ul id='sizes_change' class="clearfix">
				<li class="active"><a rel="size_1" href="#">Сложенный</a></li>
				<li><a rel="size_2" href="#">Разложенный</a></li>
			</ul>	
		<?php endif;?>
		<?php endif;?>
			<?php $counter=0;?>
			<div class="sizes">
			<?php if($sizes[0]):?>
			<?php foreach ($sizes as $id):?>
				<?php $counter++;?>
				<a class="popup size_<?=$counter ?>" <?php if($counter>1):?>style="display:none"<?php endif?> class="popup" href="<?=$this->image_Helper($id)->getUrl();?>"><?=$this->image_Helper($id)->autoCrop()->resize(240)->merge(ROOT_PATH.Zen_Theme::_('/img/loop.png'), "right - 10", "bottom - 10")->render();?></a>
			<?php endforeach;?>
			<?php endif;?>
			<?php $gab=array();
		if(isset($item['gab_length'])&&($item['gab_length']>0))	
		$gab[]=$item['gab_length'];	
		
		if(isset($item['gab_width'])&&($item['gab_width']>0))	
		$gab[]=$item['gab_width'];
		
		if(isset($item['gab_height'])&&($item['gab_height']>0))	
		$gab[]=$item['gab_height'];
		if(sizeof($gab)>0){
			$gab=implode('x',$gab);
			
		}else{
			$gab=false;
			
		}
		
	?>
			<?php if($gab):?>
				<span>Габариты..............................<?=$gab?></span>
			<?php endif;?>
			<?php 
			$sleep=array();
				if(isset($item['sleep_width'])&&($item['sleep_width']>0))	
				$sleep[]=$item['sleep_width'];
				if(isset($item['sleep_length'])&&($item['sleep_length']>0))	
				$sleep[]=$item['sleep_length'];
				if(sizeof($gab)>0){
				$sleep=implode('x',$sleep);
				}else{
					$sleep=false;
				}
			?>
			<?php if($sleep):?>
				<span>Спальное место:...................<?=$sleep?></span>
			<?php endif;?>
			
			<?php if ($item['sit_height'] || $item['sit_depth']):?>
				<span>Высота/глубина сиденья:.......<?=$item['sit_height']?>/<?=$item['sit_depth']?></span>
			<?php endif;?>
			
			</div>

	<?php if(isset($item['mech'])):?>
		<span class="sizes_label">Механизм трансформации</span>
		<?= $item['mech']['label']?>
		<?php $images=explode(',', trim($item['mech']['images']));?>
			<?php if($images[0]):?>
				<a title="<?=$item['mech']['label'] ?>" href="<?=$this->url(array('alias'=>$item['mech']['alias']),'mechItem')?>" class="mech_prev iload">
					<?=$this->image_Helper($images[0])->crop()->resize(280)->merge(ROOT_PATH.Zen_Theme::_('/img/play.png'), "50%-38", "50%-38")->render();?>
				</a>
			<?php endif;?>
	<?php endif;?>
	
	<?php if( $this->foldercid != 25 ):?>	
		<span class="sizes_label">Материалы</span>
		<a rel="nofollow" class="matpopup" href="<?=$this->url(array('module'=>'material'),'default')?>"><img alt="Материалы" src="<?=Zen_Theme::_('/img/material.png')?>"'></a>
	<?php endif;?>
	
	<div class="price">
		<a  style="background-color:white" class="button" href="/about/credit/"><span>Можно в кредит?</span></a>
	</div>
	<br/><br/>
	<div class="question">
		<a  style="background-color:white" class="button" href="/faq/" title='Часто задаваемые вопросы'><span>Есть вопросы?</span></a>
	</div>
</div>

<?php endif;?>